<template>
  <div id="app">
    <div class="title-box">
      <el-input v-model="titleText" placeholder="请输入标题"></el-input>
    </div>

    <div class="editor-box">
      <mavon-editor style="height: 100%" v-model="value"></mavon-editor>
    </div>
    <div style="margin-top: 20px;">
      <el-button @click.native="submit" type="primary">发表</el-button>
    </div>
  </div>
</template>

<script>
  import {URI_EDITORARTICLE} from 'src/const/uri'

  export default {
    data() {
      return {
        value: '',
        titleText:''
      }
    },
    components: {},
    mounted() {
    },
    methods: {
      submit() {
        if(this.titleText && this.value){
          this.$ajax.post(URI_EDITORARTICLE, {
            title:this.titleText,
            article: this.value
          }, res => {
            this.$message.success(res.message);
            this.titleText='';
            this.value='';
          });
        }
      }
    }
  }
</script>
<style scoped>
  .editor-box {
    height: 500px;
  }
  .title-box{
    margin-bottom: 20px;
  }
</style>

